// 求每个节点的深度
const depth = (node) => {
  if (!node) return -1
  return 1 + Math.max(depth(node.left), depth(node.right))
}
const isBalanced = (root) => {
  if (!root) return true
  return isBalanced(root.left) && isBalanced(root.right) && Math.abs(depth(root.left) - depth(root.right)) <= 1
};


